package pl.edu.agh.jemo.evolution.objfunc.impl.clustering;

import java.util.Comparator;

import pl.edu.agh.jemo.evolution.specimen.ISpecimen;

public class SpecimenComparator implements Comparator<ISpecimen> {

	private int dimension;
	
	public SpecimenComparator(int dimension) {
		this.dimension = dimension;
	}
	
	@Override
	public int compare(ISpecimen o1, ISpecimen o2) {
		if (o1.getGenotype().get(dimension) < o2.getGenotype().get(dimension))
			return -1;
		if (o1.getGenotype().get(dimension) > o2.getGenotype().get(dimension))
			return 1;
		return 0;
	}

}
